package Job.book.book;

public class BookMessage {
    private int bookId;
    private String bookName;
    private String author;
    private String press;
    private double price;

    public int getBookId() {
        return bookId;
    }
    public void setBookId(int bookId) {
        this.bookId = bookId;
    }
    public String getBookName() {
        return bookName;
    }
    public void setBookName(String bookName) {
        this.bookName = bookName;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getPress() {
        return press;
    }
    public void setPress(String press) {
        this.press = press;
    }
    public double getPrice() {
        return price;
    }
    public void setPrice(double price) {
        if (price > 10.00D){
            this.price = price;
        }else {
            throw new RuntimeException("价格不能小于10元或等于10元!!!");
        }
    }

    public BookMessage(int bookId, String bookName, String author, String press, double price) {
        this.setBookId(bookId);
        this.setBookName(bookName);
        this.setAuthor(author);
        this.setPress(press);
        this.setPrice(price);
    }

    public BookMessage() {
    }

    public String report(){
        System.out.println("作者:"+this.author);
        Book book = new Book();
        String info01 = book.report();
        System.out.println(info01);
        String info02 = String.format("%d\t\t%S\t\t%s  %.2f",
                this.bookId,this.bookName,this.press,this.price);
        return info02;
    }
}
